package com.guo.core.framework.mybatisTest;

import com.guo.core.framework.Dto.Transport;
import com.guo.core.framework.JDBCtest.TransportMapper;
import org.apache.ibatis.cache.Cache;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.tomcat.util.file.ConfigurationSource;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.mapper.MapperFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.AbstractResource;
import org.springframework.core.io.Resource;



import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.List;
import java.util.stream.Collectors;


/**
 * @projectName: 接口梳理
 * @package: com.guo.core.framework.mybatisTest
 * @className: Test
 * @author: zhangcan30
 * @description: TODO
 * @date: 2024/1/4 16:41
 * @version: 1.0
 */
public class Test {

    public static SqlSessionFactoryBean sqlSessionFactory = null;
//
//    static {
//        String resource = "config/mybatisConfig.xml";
//        Reader reader = null;
//
//        try {
//            reader = Resources.getResourceAsReader(resource);
//            sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader);
//
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//    }

    public static void main(String[] args) {
        ApplicationContext context=new  ClassPathXmlApplicationContext("config/test.xml");
        transportMapper transportMapper =(transportMapper) context.getBean("transportMapper");
        Transport info = transportMapper.getInfo();
        System.out.println(info);

        SqlSessionFactoryBean sqlSessionFactoryBean=new SqlSessionFactoryBean();

        MapperFactoryBean mapperFactoryBean=new MapperFactoryBean();


    }
}
